<?php
//namespace student\controller\welcome;
defined('BASEPATH') OR exit('No direct script access allowed');

class Getdatahub extends CI_Model {


	public function __construct()
	{
		parent::__construct();
		$this->load->helper('url_helper');
	}

    /**
	* 验证用户登录
    */
	public function verifyLogin($username='',$password='')
	{
		$sql = "select * from user_info where user_name=? and password=?";
		$param = array($username,$password);
		$res = $this->db->query($sql,$param)->result_array();
		return $res;
	}


    /**
	** 获取最新的数据
    **/
	public function getlatest($num)
	{
		$sql = "select * from data_info order by upload_time desc limit ?";
		$res = $this->db->query($sql,$num)->result_array();
		return $res;
	}



    /**
	** 获取热度的数据
    **/
	public function gethot($num)
	{
		$sql = "select * from data_info order by number desc limit ?";
		$res = $this->db->query($sql,$num)->result_array();
		return $res;
	}


	/**
	** 获取经典的数据
    **/
	public function getclassic($num)
	{
		$sql = "select * from data_info order by number desc limit ?";
		$res = $this->db->query($sql,$num)->result_array();
		return $res;
	}


	public function getdetail($id)
	{
		$sql = "select * from data_info where id = ?";
		$res = $this->db->query($sql,$id)->row_array();
		return $res;
	}
}
